<?php 
	$cohoi_id=$_POST['cohoi_id'];
	$content=$_POST['noidung'];
	$user_id=$_SESSION['userid'];
	$date=time();
	$trangthai=$_POST['trangthai'];
	$soanh=$_POST['hdnsoanh'];
	$hinhanhsp = "";
	for($i=1;$i<=$soanh;$i++){
		if($i<$soanh)$hinhanhsp .= $_POST["sanpham_hinhanh".$i]."~";
		else $hinhanhsp .= $_POST["sanpham_hinhanh".$i];
	}
	if($content!="")
	{
		mysql_query("
					insert
					into cohoi_notes
						(user_id,content,file_attach,cohoi_id,date)
					value
						('$user_id','$content','$hinhanhsp','$cohoi_id','$date')
				");
		mysql_query("update cohoi set trangthai='$trangthai' where id='$cohoi_id'");
		$cauthongbao="Thành công";
		$link=$url_main_site."system/index.php?tn=customers&kh=cohoi_detail&id=$cohoi_id";
		thongbao($cauthongbao,$link);
	}
	else
	{
		$cauthongbao="Bạn chưa nhập nội dung";
		$link=$url_main_site."system/index.php?tn=customers&kh=cohoi_detail&id=$cohoi_id";
		thongbao($cauthongbao,$link);
	}
	
?>